package kuanshu.mapper;

import kuanshu.bean.ZuKeXinXi;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ZuKeXinXiMapper {

    // 获取所有租客信息
    @Select("SELECT * FROM zukexinxi")
    List<ZuKeXinXi> getAllZuKeXinXi();

    // 根据ID获取租客信息
    @Select("SELECT * FROM zukexinxi WHERE zukeID = #{id}")
    ZuKeXinXi getZuKeXinXiById(int id);

    // 添加租客信息
    @Insert("INSERT INTO zukexinxi (yongHuZhangHao, zuKeBianHao, zhenShiXingMing, xingBie, shouJiHaoMa, dianZiYouXiang, shenFenZhengHao, chuShengRiQi, shenFenZhengZhengMianZhao, shenFenZhengFanMianZhao, yinHangKaHao, dangQianZuFangZhuangTai) VALUES (#{yongHuZhangHao}, #{zuKeBianHao}, #{zhenShiXingMing}, #{xingBie}, #{shouJiHaoMa}, #{dianZiYouXiang}, #{shenFenZhengHao}, #{chuShengRiQi}, #{shenFenZhengZhengMianZhao}, #{shenFenZhengFanMianZhao}, #{yinHangKaHao}, #{dangQianZuFangZhuangTai})")
    void addZuKeXinXi(ZuKeXinXi zuKeXinXi);

    // 更新租客信息
    @Update("UPDATE zukexinxi SET yongHuZhangHao = #{yongHuZhangHao}, zuKeBianHao = #{zuKeBianHao}, zhenShiXingMing = #{zhenShiXingMing}, xingBie = #{xingBie}, shouJiHaoMa = #{shouJiHaoMa}, dianZiYouXiang = #{dianZiYouXiang}, shenFenZhengHao = #{shenFenZhengHao}, chuShengRiQi = #{chuShengRiQi}, shenFenZhengZhengMianZhao = #{shenFenZhengZhengMianZhao}, shenFenZhengFanMianZhao = #{shenFenZhengFanMianZhao}, yinHangKaHao = #{yinHangKaHao}, dangQianZuFangZhuangTai = #{dangQianZuFangZhuangTai} WHERE zukeID = #{zukeID}")
    void updateZuKeXinXi(ZuKeXinXi zuKeXinXi);

    // 删除租客信息
    @Delete("DELETE FROM zukexinxi WHERE zukeID = #{id}")
    void deleteZuKeXinXi(int id);
}